#include "CApp.h"
#include "CAppEvents.h"
 
void CApp::OnEvent(SDL_Event* Event) {
	CAppEvents::OnEvent(Event);
}

void CApp::OnExit() {
    Running = false;
}

void CApp::OnKeyDown(SDLKey sym, SDLMod mod, Uint16 unicode) {
    switch(sym) {
        case SDLK_LEFT: {
            Player1.MoveLeft = true;
            break;
        }
 
        case SDLK_RIGHT: {
            Player1.MoveRight = true;
            break;
        }
 
        case SDLK_SPACE: {
			if(Player1.isGrounded())
				Player1.Jump();
            break;
        }
		case SDLK_f: {
			//if(Player1.isGrounded())
				Player1.Shoot();
            break;
        }

        default: {
        }
    }
}
 
void CApp::OnKeyUp(SDLKey sym, SDLMod mod, Uint16 unicode) {
    switch(sym) {
        case SDLK_LEFT: {
            Player1.MoveLeft = false;
            break;
        }
 
        case SDLK_RIGHT: {
            Player1.MoveRight = false;
            break;
        }
 
        default: {
        }
    }
}